<template>
  <DataList :name="name" :cate="cate" :single="true" :cols="cols" />
</template>
<script>
import DataList from "@/components/DataList";
import { getUser } from "@/utils/auth";
import { addGdzc, deleteGdzc, updateGdzc, getGdzc } from "@/api/固定资产.js";
export default {
  components: {
    DataList
  },
  data() {
    return {
      cate: "A3-5固定资产",
      name:'3.5 固定资产',
      cols: [
        { label: "全校总值", prop: "GDZCZZ" },
        { label: "其中:教学、科研仪器设备", prop: "固定资产_教学科研仪器设备",
        data:[
          { label: "资产总值", prop: "JXKYYQSBZCZ" },
          { label: "当年新增资产值", prop: "JXKYYQSBDNXZZCZ" },
        ] },
        
      ]
    };
  },
  methods: {
    
    async fetchData() {
      var user = getUser();
      var datas = await getGdzc(user.XXID,user.CJPC);
      return datas;
    },
    onadd(model){
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
      
          console.log(JSON.stringify(temp));
          var model = await addGdzc(temp);
          resolve(model);
      })
    },
    
    onupdate(model) {
      //
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
          console.log(JSON.stringify(temp));
          var model = await updateGdzc(temp);
          resolve(model);
      })
      //
    },
    ondelete(model) {
       var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
        
         await deleteGdzc(temp);
          resolve();
      })
    }
  }
};
</script>
<style>
</style>